home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / SYS / s / PrintDir.filer < prev    next >
Text File  |  1996-09-26  |  1KB  |  82 lines

  1. /* 
  2.  
  3.    $VER: PrintDir.filer 2.1 (2.4.95)
  4.  
  5.    Author:
  6.     Matthias Scheler (tron@lyssa.owl.de)
  7.  
  8.    Function:
  9.     Opens a string requester, asks for a output file and writes a listing of
  10.     the selected directory listview to the output file.
  11.  
  12.    History:
  13.     2.1   removed unnecessary ADDRESS 'FilerRexx'
  14.  
  15.    Call:
  16.     PrintDir
  17.  
  18.    Example for "Filer.RC":
  19.     BUTTON ...,...,"Print Dir","PrintDir"
  20.  
  21. */
  22.  
  23. OPTIONS RESULTS
  24.  
  25. GETSOURCEPATH
  26. IF RESULT="RESULT" THEN EXIT 5
  27. SourceDir=RESULT
  28.  
  29. LOCKFILER
  30. IF RESULT="RESULT" THEN EXIT 5
  31. Key=Result
  32.  
  33. PANEL OFF
  34.  
  35. 'STATUS Print directory'
  36.  
  37. 'SETSTRING PRT:'
  38. GETSTRING 'Choose file, or printer:'
  39. IF RESULT="RESULT" THEN
  40.  DO
  41.   PANEL ON
  42.   UNLOCKFILER Key
  43.  
  44.   EXIT 5
  45.  END
  46. TargetName=RESULT
  47.  
  48. IF OPEN('Prt',TargetName,'WRITE')=0 THEN
  49.  DO
  50.   PANEL ON
  51.   UNLOCKFILER Key
  52.  
  53.   ALERTBOX "Couldn't open output file !"
  54.   EXIT 5
  55.  END
  56.  
  57. 'STATUS Printing directory "'||SourceDir||'" to "'||TargetName||'" ...'
  58.  
  59. CALL WRITELN('Prt','Directory "'||SourceDir||'":')
  60.  
  61. GETNUMENTRIES
  62. Num=RESULT
  63. DO Index=1 TO Num
  64.  GETNAME Index
  65.  Name=RESULT
  66.  GETINFO Index
  67.  Info=RESULT
  68.  
  69.  IF UPPER(LEFT(Name,1))='F' THEN Line=LEFT(SUBSTR(Name,2)||'                              ',31)
  70.  ELSE Line=X2C(1B)||'[1m'||LEFT(SUBSTR(Name,2)||'                              ',31)||X2C(1B)||'[0m'
  71.  
  72.  CALL WRITELN('Prt',Line||Info)
  73. END
  74.  
  75. CALL WRITECH('Prt',X2C(C)||X2C(1B)||'[0m')
  76. CALL CLOSE('Prt')
  77.  
  78. 'HISTORY Printed directory "'||SourceDir||'" to "'||TargetName||'".'
  79.  
  80. PANEL ON
  81. UNLOCKFILER Key
  82.